function createRequestObject() {
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		ro = new XMLHttpRequest();
	}
	return ro;
}

var http = createRequestObject();

function getObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
		return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
		return document.layers[objectId];
    } else {
		return false;
    }
}

function selProvinces(bid) {
	
	if(bid!=0){
		//http.open('get', '{$smarty.const.__MODULE__}/Region/region/r_id/'+bid);
		http.open('get', '../../Home/Region/region/r_id/'+bid);
		http.onreadystatechange = selCities;
		http.send(null);
	}
}
function selCities() {
	if(http.readyState == 4){
		var response = http.responseText;
		getObject("city").innerHTML = '<select name="city" onChange="selDistricts(document.fromRegister.city.options[document.fromRegister.city.selectedIndex].value);"><option value="" selected>请选择城市</option>'+response+'</select>';
	}
}
function selDistricts(cid) {
	if(cid!=0){
		//http.open('get', '{$smarty.const.__MODULE__}/Region/region/r_id/'+cid);
		http.open('get', '../../Home/Region/region/r_id/'+cid);
		http.onreadystatechange = getEnds;
		http.send(null);
	}
}
function getEnds() {
	if(http.readyState == 4){
		var response = http.responseText;
		getObject("district").innerHTML = '<select name="district" class="rideselect mar10"><option value="" selected>请选择区域</option>'+response+'</select>';
	}
}